home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Source Code ƒ / TLC&TLP1.01aƒ / tlc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-28  |  7.3 KB  |  298 lines  |  [TEXT/MPS ]

  1. /* TLC.H - "The Last Cross-referencer" - Definition include file        */
  2. /*    Last Modified:    07/10/89                                            */
  3.  
  4. /*
  5. ---------------------------------------------------------------------
  6. Copyright (c) 1987-1989, Eduard Schwan Programs [esp] - All rights reserved
  7. TLC (The Last C-Cross-Referencer) and TLP (same, but for Pascal) are
  8. Cross-Reference Generators crafted and shot into the Public Domain by
  9. Eduard Schwan.  The source code and executable program may be freely
  10. distributed as long as the copyright/author notices remain intact, and
  11. it is not used in part or whole as the basis of a commercial product.
  12. Any comments, bug-fixes, or enhancements are welcome.
  13. Also, if you find TLC and it's source code useful, a contribution of
  14. $20 (check/money order) is encouraged!  Hopefully we will all see more
  15. source code distributed!
  16.     Eduard Schwan, 1112 Oceanic Drive, Encinitas, Calif. 92024
  17. ---------------------------------------------------------------------
  18. */
  19.  
  20. /*
  21. HEADER:        The Last Cross-Referencer;
  22. TITLE:        TLC/TLP - The Last Cross-Referencer;
  23. VERSION:    1.01;
  24.  
  25. DESCRIPTION: "TLC/TLP.
  26.             Definition include file";
  27.  
  28. KEYWORDS:    Utility, Cross-reference, C, Pascal, Apple, Macintosh, APW, Aztec;
  29. SYSTEM:        Macintosh MPW, v3.0;
  30. FILENAME:    TLC.H;
  31. WARNINGS:    "Has not yet been ported to MS-DOS.
  32.             Shareware, $20 Check/Money Order suggested.";
  33.  
  34. SEE-ALSO:    README.TLC,TLCHELP.DOC,TLPHELP.DOC;
  35. AUTHORS:    Eduard Schwan;
  36. COMPILERS:    AZTEC C65 v3.2b, APPLEIIGS APW C v1.0, APPLE MACINTOSH MPW C v3.0;
  37. */
  38.  
  39.  
  40. /*--- defining "do_dbg" at compile time activates all debug lines ---*/
  41. /*--- then the '-d' option forces display of them while TLC runs  ---*/
  42.  
  43.  
  44. #define do_dbg        /* comment this out for no debugs.. */
  45.  
  46. #ifdef do_dbg
  47. #define debug(x)    {if(enable_debugs){x;getchar();}}
  48. #else
  49. #define debug(x)
  50. #endif
  51.  
  52.  
  53. /*-------------- Compiler-dependent Definitions ---------*/
  54.  
  55. #ifdef AppleIIgs
  56. /* APW C */
  57. /* for boolean, TRUE, FALSE, byte definitions */
  58. #include <types.h>
  59. #define FILLCHAR(farea,fsize,fvalue)  memset(farea,fvalue,fsize)
  60. #define MOVEBYTE(msource,mdest,msize) memcpy(mdest,msource,msize)
  61. #else
  62. #ifdef macintosh
  63. /* MPW C */
  64. #define FILLCHAR(farea,fsize,fvalue)  memset(farea,fvalue,fsize)
  65. #define MOVEBYTE(msource,mdest,msize) memcpy(mdest,msource,msize)
  66. #else
  67. /* Aztec C */
  68. #define FILLCHAR(farea,fsize,fvalue)  setmem(farea,fsize,fvalue)
  69. #define MOVEBYTE(msource,mdest,msize) movmem(msource,mdest,msize)
  70. #endif
  71. #endif
  72.  
  73. /* comment this out if you cannot assign structures */
  74. #define STRUCT_ASSIGN    1
  75.  
  76. #define VOID    void    /* define VOID to int for non-void compilers */
  77.  
  78.  
  79. /*---------------------- definitions --------------------*/
  80.  
  81. #define     TLC_VERSION     "1.01a 07/10/89"
  82. #define     LINE_SIZE        255
  83. #define     FNAME_SIZE        64
  84. #define     DATE_SIZE        30
  85. #define     MAX_SYM_SIZE    32    /* maximum symbol (id) size */
  86.  
  87. #ifndef AppleIIgs
  88. /* already in types.h */
  89. #define     TRUE            1    /* boolean types are set to these */
  90. #define     FALSE            0
  91. #endif
  92.  
  93. #define     BAD_EXIT        99
  94. #define     GOOD_EXIT        0
  95.  
  96. #define     CH_FF            '\014'    /* printer form-feed character */
  97. #define     CH_COMMENT        '*'     /* comment char for file list file */
  98. #define     CH_SPACE        ' '     /* space character! */
  99.  
  100. #define     TOK_ID            1
  101. #define     TOK_NCONST        2
  102. #define     TOK_CCONST        3
  103. #define     TOK_SCONST        4
  104.  
  105. #define     TOK_EQUALS        '='
  106. #define     TOK_LBRACE        '{'
  107. #define     TOK_RBRACE        '}'
  108. #define     TOK_LPAREN        '('
  109. #define     TOK_RPAREN        ')'
  110.  
  111. #define     TERR_BAD_CHR    -1000 /* get_token() error values */
  112. #define     TERR_BAD_STR    -1001
  113. #define     TERR_EOLN        -1010
  114.  
  115. #define     REF_BLANK        0    /* reference tags on xref line numbers */
  116. #define     REF_FUNCHEAD    1
  117. #define     REF_DEFINE        2
  118. #define     REF_PROCHEAD    2
  119. #define     REF_UNITHEAD    3
  120. #define        MAX_REF_CHARS    4
  121.  
  122. #define     EMPH_NONE        0    /* Emphasis style values */
  123. #define     EMPH_ONE        1
  124. #define     EMPH_TWO        2
  125. #define     EMPH_THREE        3
  126. #define     EMPH_MAX        3    /* should be total # of emph values above */
  127.  
  128. #define     B_octal          8    /* Number bases used */
  129. #define     B_decimal        10
  130. #define     B_hex            16
  131.  
  132. #define        memdispFmt        "[%6lu] "    /* verbose FreeMem display */
  133.  
  134.  
  135. /*-------- globally external variables for everyone ---------*/
  136.  
  137.  
  138.  
  139. /*---------------- structure definitions -----------------*/
  140.  
  141. #ifndef AppleIIgs
  142. /* already in types.h */
  143. typedef unsigned char            boolean;
  144. typedef unsigned char            byte;
  145. #endif
  146.  
  147. typedef unsigned short int        pos_int;
  148.  
  149. typedef char                    date_str_type[DATE_SIZE];
  150. typedef char                    fname_type[FNAME_SIZE];
  151. typedef char                    line_type[LINE_SIZE];
  152.  
  153.  
  154. /*------------------ emphasize type record --------------*/
  155. struct    emph_r_type
  156.     {
  157.     char*                        emph_leadin;
  158.     char*                        emph_leadout;
  159.     };
  160. typedef struct emph_r_type         emph_rec_type;
  161.  
  162.  
  163. /*-------------------- file list record -----------------*/
  164. struct    file_l_type
  165.     {
  166.     pos_int                     file_num;
  167.     pos_int                        num_lines;
  168.     char*                        file_name;
  169.     struct file_l_type*            next;
  170.     };
  171. typedef struct file_l_type         file_list_type;
  172.  
  173.  
  174. struct    file_r_type
  175.     {
  176.     pos_int                     num_in_fnames;
  177.     file_list_type*             file_list;
  178.     file_list_type*             curr_file;
  179.     fname_type                    parm_fname;
  180.     fname_type                    resw_fname;
  181.     };
  182. typedef struct file_r_type         file_rec_type;
  183.  
  184.  
  185. /*-------------------- parameter record -----------------*/
  186. struct    parm_r_type
  187.     {
  188.             /* GENERAL */
  189.     boolean                     do_includes;
  190.     boolean                     do_listing;
  191.     boolean                     do_xref;
  192.     boolean                     do_stats;
  193.     char*                        out_fname;
  194.  
  195.             /* PRINTER */
  196.     pos_int                     page_lines;
  197.     pos_int                     page_columns;
  198.     pos_int                     top_line;
  199.     pos_int                     bot_line;
  200.     pos_int                     left_column;
  201.     pos_int                     right_column;
  202.     char*                        user_heading;
  203.     boolean                     do_single_shts;
  204.     char*                        printer_init;
  205.     boolean                     has_form_feed;
  206.     pos_int                     first_page;
  207.     pos_int                     last_page;
  208.  
  209.             /* LISTING */
  210.     pos_int                     tab_width;
  211.     byte                        emph_comments;
  212.     byte                        emph_heading;
  213.     byte                        emph_reserved;
  214.     byte                        emph_funcheads;
  215.     char*                        paging_string;
  216.  
  217.             /* XREF */
  218.     pos_int                     symbol_size;
  219.     boolean                     xref_nums;
  220.     boolean                     xref_strings;
  221.     boolean                     do_conditionals;
  222.     boolean                     do_case_sens;
  223.     boolean                     do_xcase_sens;
  224.     boolean                     do_underscores;
  225.     byte                        emph_symbols;
  226.  
  227.             /* STATS */
  228.     };
  229. typedef struct parm_r_type         parm_rec_type;
  230.  
  231.  
  232. /*------------------- reserved word record --------------*/
  233. struct    resw_l_type
  234.     {
  235.     struct resw_l_type*            left;
  236.     struct resw_l_type*            right;
  237.     char*                        resword;
  238.     byte                        tok_type;
  239.     unsigned long                occurrances;
  240.     };
  241. typedef struct resw_l_type         resw_list_type;
  242.  
  243. struct    resw_r_type
  244.     {
  245.     pos_int                     num_reswords;
  246.     resw_list_type*             resw_list;
  247.     };
  248. typedef struct resw_r_type     resw_rec_type;
  249.  
  250.  
  251. /*------------------ line list record -------------------*/
  252. struct    line_l_type
  253.     {
  254.     pos_int                     line_number;
  255.     file_list_type*             file_ptr;
  256.     byte                        reference_type;
  257.     struct line_l_type*            next;
  258.     };
  259. typedef struct line_l_type         line_list_type;
  260.  
  261.  
  262. /*------------------ symbol table records ---------------*/
  263. struct    sym_l_type
  264.     {
  265.     struct sym_l_type*             left;
  266.     struct sym_l_type*             right;
  267.     char*                        sym_name;
  268.     byte                        sym_type;
  269.     line_list_type*             line_list;
  270.     line_list_type*             line_tail;
  271.     };
  272. typedef struct sym_l_type        sym_list_type;
  273.  
  274. struct    sym_t_type
  275.     {
  276.     sym_list_type*                symbol_list;
  277.     };
  278. typedef struct sym_t_type        sym_table_type;
  279.  
  280.  
  281. /*---------------------- status record ------------------*/
  282. struct    stat_r_type
  283.     {
  284.     pos_int                     total_lines;
  285.     };
  286. typedef struct stat_r_type         stat_rec_type;
  287.  
  288.  
  289. /*-------------------- token record ---------------------*/
  290. struct    tok_r_type
  291.     {
  292.     pos_int                     tok_type;
  293.     line_type                    tok_string;
  294.     long                        tok_value;
  295.     pos_int                     tok_column;
  296.     };
  297. typedef struct tok_r_type        token_rec_type;
  298.